//验证码倒计时
const timer = (task, initValue, interval) => {
	let count = 1
	const timer = setInterval((() => () => {
		const n = (initValue || 59) - count
		task(n)
		if (n <= 0) {
			clearInterval(timer)
		}
		count++
	})(count), interval || 1000)
}

export default timer